package de.baumann.browser.api.net

import de.baumann.browser.BuildConfig
import de.baumann.browser.api.net.base.BaseUrl
import de.baumann.browser.api.net.vo.Result
import de.baumann.browser.api.net.vo.duobao.Banner
import de.baumann.browser.api.net.vo.duobao.DuoBao
import de.baumann.browser.api.net.vo.duobao.DuoBaoMsg
import de.baumann.browser.api.net.vo.duobao.OrderResult
import io.reactivex.Observable
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
import retrofit2.http.POST

@BaseUrl("${BuildConfig.DUOBAO_API_URL}api/activityController/")
interface DuoBaoApiService {

    @POST("selectHomeCarousel")
    fun selectHomeCarousel():Observable<Result<List<Banner>>>

    @POST("getNews")
    fun getDuoBaoMsg(): Observable<Result<DuoBaoMsg>>

    @POST("getHaveInActivity")
    fun getDuoBaoList(): Observable<Result<List<DuoBao>>>

    @FormUrlEncoded
    @POST("getActivityDetail")
    fun getDuoBaoDetail(@Field("id") id: String): Observable<Result<DuoBao>>

    @FormUrlEncoded
    @POST("payment")
    fun createOrder(@Field("activityId") id: String,
                    @Field("participation_num") num: String): Observable<Result<OrderResult>>

    @FormUrlEncoded
    @POST("confirm")
    fun payConfirm(@Field("user_activity_key") key: String,
                   @Field("activityId") id: String,
                   @Field("participation_num") number: String,
                   @Field("transaction_hash") hash: String,
                   @Field("transaction_odin") odin: String): Observable<Result<Any>>
}